package complexity;

public class SimpleExample {

	/**
	 * Complexity = 2, Depth = 3
	 */
	public void ifConditionOnly() {
		if (isTodaySunday()) {
			sayYa();
		}
	}

	/**
	 * Complexity = 3, Depth = 3
	 */
	public void ifElseConditionOnly() {
		if (isTodaySunday()) {
			sayYa();
		} else {
			System.out.println("Nooooooo!");
		}
	}

	/**
	 * Complexity = 2, Depth = 3
	 */
	public void forConditionOnly() {
		for (int i = 0; i < 5; i++) {
			sayYa();
		}
	}

	/**
	 * Complexity = 2, Depth = 3
	 */
	public void whileConditionOnly() {
		int i = 0;
		while (i < 5) {
			i++;
		}
	}

	/**
	 * Complexity = 2, Depth = 2
	 */
	public boolean andConditionOnly() {
		return (true && false);
	}

	/**
	 * Complexity = 2, Depth = 2
	 */
	public boolean orConditionOnly() {
		return (false || true);
	}

	/**
	 * Complexity = 2, Depth = 3
	 */
	public void tryStatementOnly() {
		try {
			sayYa();
		} catch (Exception e) {
			sayYa();
		} finally {
			System.out.println("Finish");
		}
	}

	/**
	 * Complexity = 1, Depth = 2
	 */
	private boolean isTodaySunday() {
		return true;
	}

	/**
	 * Complexity = 1, Depth = 2
	 */
	private void sayYa() {
		System.out.println("Ya");
	}
}
